# -*- coding: utf-8 -*-
# @Time    : 2018/5/24 下午8:54
# @Author  : Lavn
# @Email   : 959875529@qq.com
# @File    : for.py
# @Software: PyCharm

#while

count = 1
sum1 = 0
while (count <= 100):
    sum1 = count + sum1
    count = count + 1
print(sum1)
print('\n')

#break
count = 1
sum1 = 0
while (count <= 100):
    sum1 = count + sum1
    if(sum1 > 1000):
        break
    count = count + 1
print(sum1)
print('\n')

#continue
count = 1
sum1 = 0
while (count <= 100):
    if(count % 2 == 0):
        count =  count + 1
        continue
    sum1 = count + sum1
    count = count + 1
print(sum1)
print('\n')

#while else
count = 0
while count < 5:
   print (count)
   count = count + 1
else:
   print (count)

print('\n')


#for
sum = 0
for i in range(11):
    sum += i
print(sum)
print('\n')

for x in ['a','b','c']:
    print(x)
print('\n')


# for i in range(1, 10):
#         for j in range(1, i+1):
#             # 打印语句中，大括号及其里面的字符 (称作格式化字段) 将会被 .format() 中的参数替换,注意有个点的
#             # print('{}x{}={}\t'.format(i, j, i*j), end='')
#             # print('%d X %d = %d' % (i,j,i*j))

for i in range(1, 10):
        for j in range(1, i+1):
            print('%d X %d = %d  ' % (i, j, i * j),end='')
        print('\n')